// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod os_config_service {
    use crate::Result;

    /// A builder for [OsConfigService][crate::client::OsConfigService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_osconfig_v1::*;
    /// # use builder::os_config_service::ClientBuilder;
    /// # use client::OsConfigService;
    /// let builder : ClientBuilder = OsConfigService::builder();
    /// let client = builder
    ///     .with_endpoint("https://osconfig.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::OsConfigService;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = OsConfigService;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::OsConfigService] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [OsConfigService::execute_patch_job][crate::client::OsConfigService::execute_patch_job] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::ExecutePatchJob;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ExecutePatchJob {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ExecutePatchJob(RequestBuilder<crate::model::ExecutePatchJobRequest>);

    impl ExecutePatchJob {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ExecutePatchJobRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchJob> {
            (*self.0.stub)
                .execute_patch_job(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::ExecutePatchJobRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [description][crate::model::ExecutePatchJobRequest::description].
        pub fn set_description<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.description = v.into();
            self
        }

        /// Sets the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
        ///
        /// This is a **required** field for requests.
        pub fn set_instance_filter<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::PatchInstanceFilter>,
        {
            self.0.request.instance_filter = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::PatchInstanceFilter>,
        {
            self.0.request.instance_filter = v.map(|x| x.into());
            self
        }

        /// Sets the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
        pub fn set_patch_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::PatchConfig>,
        {
            self.0.request.patch_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
        pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::PatchConfig>,
        {
            self.0.request.patch_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [duration][crate::model::ExecutePatchJobRequest::duration].
        pub fn set_duration<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.0.request.duration = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [duration][crate::model::ExecutePatchJobRequest::duration].
        pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.0.request.duration = v.map(|x| x.into());
            self
        }

        /// Sets the value of [dry_run][crate::model::ExecutePatchJobRequest::dry_run].
        pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.dry_run = v.into();
            self
        }

        /// Sets the value of [display_name][crate::model::ExecutePatchJobRequest::display_name].
        pub fn set_display_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.display_name = v.into();
            self
        }

        /// Sets the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
        pub fn set_rollout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::PatchRollout>,
        {
            self.0.request.rollout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
        pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::PatchRollout>,
        {
            self.0.request.rollout = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ExecutePatchJob {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::get_patch_job][crate::client::OsConfigService::get_patch_job] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::GetPatchJob;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetPatchJob {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetPatchJob(RequestBuilder<crate::model::GetPatchJobRequest>);

    impl GetPatchJob {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetPatchJobRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchJob> {
            (*self.0.stub)
                .get_patch_job(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetPatchJobRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetPatchJob {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::cancel_patch_job][crate::client::OsConfigService::cancel_patch_job] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::CancelPatchJob;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CancelPatchJob {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CancelPatchJob(RequestBuilder<crate::model::CancelPatchJobRequest>);

    impl CancelPatchJob {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CancelPatchJobRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchJob> {
            (*self.0.stub)
                .cancel_patch_job(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::CancelPatchJobRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CancelPatchJob {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::list_patch_jobs][crate::client::OsConfigService::list_patch_jobs] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::ListPatchJobs;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListPatchJobs {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListPatchJobs(RequestBuilder<crate::model::ListPatchJobsRequest>);

    impl ListPatchJobs {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListPatchJobsRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListPatchJobsResponse> {
            (*self.0.stub)
                .list_patch_jobs(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListPatchJobsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListPatchJobsResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListPatchJobsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListPatchJobsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListPatchJobsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListPatchJobsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListPatchJobs {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::list_patch_job_instance_details][crate::client::OsConfigService::list_patch_job_instance_details] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::ListPatchJobInstanceDetails;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListPatchJobInstanceDetails {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListPatchJobInstanceDetails(
        RequestBuilder<crate::model::ListPatchJobInstanceDetailsRequest>,
    );

    impl ListPatchJobInstanceDetails {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListPatchJobInstanceDetailsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListPatchJobInstanceDetailsResponse> {
            (*self.0.stub)
                .list_patch_job_instance_details(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListPatchJobInstanceDetailsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListPatchJobInstanceDetailsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListPatchJobInstanceDetailsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListPatchJobInstanceDetailsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListPatchJobInstanceDetailsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListPatchJobInstanceDetailsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListPatchJobInstanceDetails {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::create_patch_deployment][crate::client::OsConfigService::create_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::CreatePatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreatePatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreatePatchDeployment(RequestBuilder<crate::model::CreatePatchDeploymentRequest>);

    impl CreatePatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreatePatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchDeployment> {
            (*self.0.stub)
                .create_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreatePatchDeploymentRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [patch_deployment_id][crate::model::CreatePatchDeploymentRequest::patch_deployment_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_patch_deployment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.patch_deployment_id = v.into();
            self
        }

        /// Sets the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
        ///
        /// This is a **required** field for requests.
        pub fn set_patch_deployment<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::PatchDeployment>,
        {
            self.0.request.patch_deployment = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::PatchDeployment>,
        {
            self.0.request.patch_deployment = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreatePatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::get_patch_deployment][crate::client::OsConfigService::get_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::GetPatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetPatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetPatchDeployment(RequestBuilder<crate::model::GetPatchDeploymentRequest>);

    impl GetPatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetPatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchDeployment> {
            (*self.0.stub)
                .get_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetPatchDeploymentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetPatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::list_patch_deployments][crate::client::OsConfigService::list_patch_deployments] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::ListPatchDeployments;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListPatchDeployments {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListPatchDeployments(RequestBuilder<crate::model::ListPatchDeploymentsRequest>);

    impl ListPatchDeployments {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListPatchDeploymentsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListPatchDeploymentsResponse> {
            (*self.0.stub)
                .list_patch_deployments(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListPatchDeploymentsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListPatchDeploymentsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListPatchDeploymentsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListPatchDeploymentsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListPatchDeploymentsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListPatchDeployments {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::delete_patch_deployment][crate::client::OsConfigService::delete_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::DeletePatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeletePatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeletePatchDeployment(RequestBuilder<crate::model::DeletePatchDeploymentRequest>);

    impl DeletePatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeletePatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeletePatchDeploymentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeletePatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::update_patch_deployment][crate::client::OsConfigService::update_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::UpdatePatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdatePatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdatePatchDeployment(RequestBuilder<crate::model::UpdatePatchDeploymentRequest>);

    impl UpdatePatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdatePatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchDeployment> {
            (*self.0.stub)
                .update_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
        ///
        /// This is a **required** field for requests.
        pub fn set_patch_deployment<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::PatchDeployment>,
        {
            self.0.request.patch_deployment = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::PatchDeployment>,
        {
            self.0.request.patch_deployment = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdatePatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::pause_patch_deployment][crate::client::OsConfigService::pause_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::PausePatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> PausePatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct PausePatchDeployment(RequestBuilder<crate::model::PausePatchDeploymentRequest>);

    impl PausePatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::PausePatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchDeployment> {
            (*self.0.stub)
                .pause_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::PausePatchDeploymentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for PausePatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::resume_patch_deployment][crate::client::OsConfigService::resume_patch_deployment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::ResumePatchDeployment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ResumePatchDeployment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ResumePatchDeployment(RequestBuilder<crate::model::ResumePatchDeploymentRequest>);

    impl ResumePatchDeployment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ResumePatchDeploymentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::PatchDeployment> {
            (*self.0.stub)
                .resume_patch_deployment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::ResumePatchDeploymentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ResumePatchDeployment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::get_operation][crate::client::OsConfigService::get_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::GetOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);

    impl GetOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .get_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigService::cancel_operation][crate::client::OsConfigService::cancel_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_service::CancelOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CancelOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);

    impl CancelOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .cancel_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CancelOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}

pub mod os_config_zonal_service {
    use crate::Result;

    /// A builder for [OsConfigZonalService][crate::client::OsConfigZonalService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_osconfig_v1::*;
    /// # use builder::os_config_zonal_service::ClientBuilder;
    /// # use client::OsConfigZonalService;
    /// let builder : ClientBuilder = OsConfigZonalService::builder();
    /// let client = builder
    ///     .with_endpoint("https://osconfig.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::OsConfigZonalService;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = OsConfigZonalService;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::OsConfigZonalService] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [OsConfigZonalService::create_os_policy_assignment][crate::client::OsConfigZonalService::create_os_policy_assignment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::CreateOSPolicyAssignment;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateOSPolicyAssignment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateOSPolicyAssignment(
        RequestBuilder<crate::model::CreateOSPolicyAssignmentRequest>,
    );

    impl CreateOSPolicyAssignment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateOSPolicyAssignmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [create_os_policy_assignment][crate::client::OsConfigZonalService::create_os_policy_assignment].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .create_os_policy_assignment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `create_os_policy_assignment`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<
            crate::model::OSPolicyAssignment,
            crate::model::OSPolicyAssignmentOperationMetadata,
        > {
            type Operation = lro::internal::Operation<
                crate::model::OSPolicyAssignment,
                crate::model::OSPolicyAssignmentOperationMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        /// Sets the value of [parent][crate::model::CreateOSPolicyAssignmentRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
        ///
        /// This is a **required** field for requests.
        pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::OSPolicyAssignment>,
        {
            self.0.request.os_policy_assignment = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::OSPolicyAssignment>,
        {
            self.0.request.os_policy_assignment = v.map(|x| x.into());
            self
        }

        /// Sets the value of [os_policy_assignment_id][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_os_policy_assignment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.os_policy_assignment_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateOSPolicyAssignment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::update_os_policy_assignment][crate::client::OsConfigZonalService::update_os_policy_assignment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::UpdateOSPolicyAssignment;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateOSPolicyAssignment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateOSPolicyAssignment(
        RequestBuilder<crate::model::UpdateOSPolicyAssignmentRequest>,
    );

    impl UpdateOSPolicyAssignment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateOSPolicyAssignmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [update_os_policy_assignment][crate::client::OsConfigZonalService::update_os_policy_assignment].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .update_os_policy_assignment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `update_os_policy_assignment`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<
            crate::model::OSPolicyAssignment,
            crate::model::OSPolicyAssignmentOperationMetadata,
        > {
            type Operation = lro::internal::Operation<
                crate::model::OSPolicyAssignment,
                crate::model::OSPolicyAssignmentOperationMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        /// Sets the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
        ///
        /// This is a **required** field for requests.
        pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::OSPolicyAssignment>,
        {
            self.0.request.os_policy_assignment = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::OSPolicyAssignment>,
        {
            self.0.request.os_policy_assignment = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateOSPolicyAssignment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::get_os_policy_assignment][crate::client::OsConfigZonalService::get_os_policy_assignment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::GetOSPolicyAssignment;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOSPolicyAssignment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOSPolicyAssignment(RequestBuilder<crate::model::GetOSPolicyAssignmentRequest>);

    impl GetOSPolicyAssignment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetOSPolicyAssignmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::OSPolicyAssignment> {
            (*self.0.stub)
                .get_os_policy_assignment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetOSPolicyAssignmentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOSPolicyAssignment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::list_os_policy_assignments][crate::client::OsConfigZonalService::list_os_policy_assignments] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::ListOSPolicyAssignments;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListOSPolicyAssignments {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListOSPolicyAssignments(
        RequestBuilder<crate::model::ListOSPolicyAssignmentsRequest>,
    );

    impl ListOSPolicyAssignments {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListOSPolicyAssignmentsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListOSPolicyAssignmentsResponse> {
            (*self.0.stub)
                .list_os_policy_assignments(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListOSPolicyAssignmentsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListOSPolicyAssignmentsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListOSPolicyAssignments {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::list_os_policy_assignment_revisions][crate::client::OsConfigZonalService::list_os_policy_assignment_revisions] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::ListOSPolicyAssignmentRevisions;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListOSPolicyAssignmentRevisions {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListOSPolicyAssignmentRevisions(
        RequestBuilder<crate::model::ListOSPolicyAssignmentRevisionsRequest>,
    );

    impl ListOSPolicyAssignmentRevisions {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListOSPolicyAssignmentRevisionsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListOSPolicyAssignmentRevisionsResponse> {
            (*self.0.stub)
                .list_os_policy_assignment_revisions(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListOSPolicyAssignmentRevisionsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListOSPolicyAssignmentRevisionsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [name][crate::model::ListOSPolicyAssignmentRevisionsRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListOSPolicyAssignmentRevisions {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::delete_os_policy_assignment][crate::client::OsConfigZonalService::delete_os_policy_assignment] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::DeleteOSPolicyAssignment;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteOSPolicyAssignment {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteOSPolicyAssignment(
        RequestBuilder<crate::model::DeleteOSPolicyAssignmentRequest>,
    );

    impl DeleteOSPolicyAssignment {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteOSPolicyAssignmentRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [delete_os_policy_assignment][crate::client::OsConfigZonalService::delete_os_policy_assignment].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .delete_os_policy_assignment(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `delete_os_policy_assignment`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<(), crate::model::OSPolicyAssignmentOperationMetadata> {
            type Operation = lro::internal::Operation<
                wkt::Empty,
                crate::model::OSPolicyAssignmentOperationMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_unit_response_poller(
                polling_error_policy,
                polling_backoff_policy,
                start,
                query,
            )
        }

        /// Sets the value of [name][crate::model::DeleteOSPolicyAssignmentRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteOSPolicyAssignment {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::get_os_policy_assignment_report][crate::client::OsConfigZonalService::get_os_policy_assignment_report] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::GetOSPolicyAssignmentReport;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOSPolicyAssignmentReport {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOSPolicyAssignmentReport(
        RequestBuilder<crate::model::GetOSPolicyAssignmentReportRequest>,
    );

    impl GetOSPolicyAssignmentReport {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetOSPolicyAssignmentReportRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::OSPolicyAssignmentReport> {
            (*self.0.stub)
                .get_os_policy_assignment_report(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetOSPolicyAssignmentReportRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOSPolicyAssignmentReport {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::list_os_policy_assignment_reports][crate::client::OsConfigZonalService::list_os_policy_assignment_reports] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::ListOSPolicyAssignmentReports;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListOSPolicyAssignmentReports {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListOSPolicyAssignmentReports(
        RequestBuilder<crate::model::ListOSPolicyAssignmentReportsRequest>,
    );

    impl ListOSPolicyAssignmentReports {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListOSPolicyAssignmentReportsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListOSPolicyAssignmentReportsResponse> {
            (*self.0.stub)
                .list_os_policy_assignment_reports(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListOSPolicyAssignmentReportsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListOSPolicyAssignmentReportsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentReportsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentReportsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListOSPolicyAssignmentReportsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentReportsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListOSPolicyAssignmentReports {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::get_inventory][crate::client::OsConfigZonalService::get_inventory] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::GetInventory;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetInventory {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetInventory(RequestBuilder<crate::model::GetInventoryRequest>);

    impl GetInventory {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetInventoryRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::Inventory> {
            (*self.0.stub)
                .get_inventory(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetInventoryRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [view][crate::model::GetInventoryRequest::view].
        pub fn set_view<T: Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
            self.0.request.view = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetInventory {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::list_inventories][crate::client::OsConfigZonalService::list_inventories] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::ListInventories;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListInventories {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListInventories(RequestBuilder<crate::model::ListInventoriesRequest>);

    impl ListInventories {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListInventoriesRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListInventoriesResponse> {
            (*self.0.stub)
                .list_inventories(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListInventoriesResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<crate::model::ListInventoriesResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListInventoriesRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [view][crate::model::ListInventoriesRequest::view].
        pub fn set_view<T: Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
            self.0.request.view = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListInventoriesRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListInventoriesRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListInventoriesRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListInventories {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::get_vulnerability_report][crate::client::OsConfigZonalService::get_vulnerability_report] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::GetVulnerabilityReport;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetVulnerabilityReport {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetVulnerabilityReport(RequestBuilder<crate::model::GetVulnerabilityReportRequest>);

    impl GetVulnerabilityReport {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetVulnerabilityReportRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::VulnerabilityReport> {
            (*self.0.stub)
                .get_vulnerability_report(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetVulnerabilityReportRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetVulnerabilityReport {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::list_vulnerability_reports][crate::client::OsConfigZonalService::list_vulnerability_reports] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::ListVulnerabilityReports;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListVulnerabilityReports {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListVulnerabilityReports(
        RequestBuilder<crate::model::ListVulnerabilityReportsRequest>,
    );

    impl ListVulnerabilityReports {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListVulnerabilityReportsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListVulnerabilityReportsResponse> {
            (*self.0.stub)
                .list_vulnerability_reports(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<
            crate::model::ListVulnerabilityReportsResponse,
            gax::error::Error,
        > {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListVulnerabilityReportsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListVulnerabilityReportsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListVulnerabilityReportsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListVulnerabilityReportsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListVulnerabilityReportsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListVulnerabilityReports {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::get_operation][crate::client::OsConfigZonalService::get_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::GetOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);

    impl GetOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .get_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsConfigZonalService::cancel_operation][crate::client::OsConfigZonalService::cancel_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_osconfig_v1::builder;
    /// use builder::os_config_zonal_service::CancelOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CancelOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);

    impl CancelOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsConfigZonalService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .cancel_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CancelOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
